using System;
public class Node<T>
{
    public Node<T> Next { get; set; }
    public T data { get; set; }
    public Node(T t)
    {
        Next = null;
        data = t;
    }
}
public class GenericList<T>
{
    public Node<T> head;//主函数访问
    private Node<T> tail;
    public GenericList()
    {
        head = tail = null;
    }
    public void add(T t)
    {
        Node<T> n = new Node<T>(t);
        if (tail == null)
        {
            head = tail = n;
        }
        else
        {
            tail.Next = n;
            tail = n;
        }
    }
    public void ForEach(Action<T> action)
    {
        Node<T> node = head;
        while (node != null)
        {
            action(node.data);
            node = node.Next;
        }
    }
}
class Test
{
    public static void Main()
    {
        GenericList<int> intlist = new GenericList<int>();
        string input = Console.ReadLine();
        string[] numStr = input.Split(' ');

        for (int i = 0; i < numStr.Length; i++)
        {
            if (int.TryParse(numStr[i], out int parsedNumber))
            {
                intlist.add(parsedNumber);
            }
            else
            {
                Console.WriteLine($"Cannot parse the {i + 1}th number: {numStr[i]}");
            }
        }

        /* for (int x = 0; x < 10; x++)
         {
             intlist.add(x);
         }*/
        intlist.ForEach(data => Console.WriteLine(data));

        int max =intlist.head.data ;//初始化变量为第一个元素
        intlist.ForEach(data => max = Math.Max(max, data));
        Console.WriteLine("最大: " + max);
        int min =intlist.head.data;
        intlist.ForEach(data => min = Math.Min(min, data));
        Console.WriteLine("最小：" + min);
        int sum = 0;
        intlist.ForEach(data => sum += data);
        Console.WriteLine("和" + sum);
    }
}
